package com.healthbox.notifications.controller;


import com.healthbox.notifications.commom.Result;
import com.healthbox.notifications.entity.HealthState;
import com.healthbox.notifications.entity.ReportInfo;
import com.healthbox.notifications.service.ReportInfoService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chs
 * @since 2022-05-12
 */
@RestController
@Api(tags = "信息报备系统")
@RequestMapping("/reportinfo")
public class ReportInfoController {

    @Autowired
    ReportInfoService reportInfoService;

    @ApiOperation(value = "填写报备信息",notes = "用户可以提交报备信息")
    @ApiResponses({ @ApiResponse(code = 200, message = "操作成功",response = ReportInfo.class ) })
    @PostMapping("/add")
    public Result addReportInfo(@RequestBody ReportInfo reportInfo,
                                @RequestHeader("user-phone") String phone
    ){

        return reportInfoService.addReportInfo(reportInfo,phone);
    }

    @ApiOperation(value = "查看历史报备信息",notes = "用户可以查看历史报备信息")
    @ApiImplicitParam(name = "phoneNum", value = "用户手机号（账号）", type = "Long", paramType = "query")
    @GetMapping("/get")
    public Result getReportInfoList(@RequestHeader("user-phone") String phone){

        return reportInfoService.getReportInfoList(phone);
    }

}
